package main

import (
	"flag"
	"fmt"
	"golang_practise/04-grpc_demo/proto"
	"golang_practise/04-grpc_demo/sensitive_server/server"
	"google.golang.org/grpc"
	"log"
	"net"
)

func main() {
	port := flag.Int("port", 50051, "")
	flag.Parse()

	lis, err := net.Listen("tcp", fmt.Sprintf(":%d", *port))
	if err != nil {
		log.Fatal(err)
	}

	s := grpc.NewServer()
	proto.RegisterSensitiveFilterServer(s, &server.SensitiveServer{})
	err = s.Serve(lis)
	if err != nil {
		log.Fatal(err)
	}
}
